﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace PPSignSDKDemoSharp
{
    /// <summary>
    /// Interaction logic for L1000SignWnd.xaml
    /// </summary>
    public partial class L1000SignWnd : Window
    {
        public TextBlock g_tbStatus = null;
        MainWindow mainWnd;

        public L1000SignWnd(MainWindow mw)
        {
            mainWnd = mw;

            InitializeComponent();
            this.WindowStyle = WindowStyle.None; // tool window...
            this.ResizeMode = ResizeMode.NoResize;

            // create cancel button
            Button cancelBtn = new Button();
            cancelBtn.Name = "cancelBtn";
            cancelBtn.HorizontalAlignment = HorizontalAlignment.Left;
            cancelBtn.VerticalAlignment = VerticalAlignment.Top;
            cancelBtn.Margin = new Thickness(440, 730, 0, 0);
            cancelBtn.Width = 100;
            cancelBtn.Height = 50;
            cancelBtn.Content = "Cancel";
            cancelBtn.Click += CancelBtn_Click;
            this.grid.Children.Add(cancelBtn);

            // create ok button
            Button okBtn = new Button();
            okBtn.Name = "okBtn";
            okBtn.HorizontalAlignment = HorizontalAlignment.Left;
            okBtn.VerticalAlignment = VerticalAlignment.Top;
            okBtn.Margin = new Thickness(740, 730, 0, 0);
            okBtn.Width = 100;
            okBtn.Height = 50;
            okBtn.Content = "OK";
            okBtn.Click += OKBtn_Click;
            this.grid.Children.Add(okBtn);

            // create text block (tbStatus)
            g_tbStatus = new TextBlock();
            g_tbStatus.Name = "L1000_tbStatus";
            g_tbStatus.Text = "You may start signing now.";
            g_tbStatus.TextAlignment = TextAlignment.Center;
            g_tbStatus.HorizontalAlignment = HorizontalAlignment.Left;
            g_tbStatus.VerticalAlignment = VerticalAlignment.Top;
            g_tbStatus.TextWrapping = TextWrapping.NoWrap;
            g_tbStatus.Margin = new Thickness(50, 660, 0, 0);
            g_tbStatus.Width = 1180;
            g_tbStatus.Height = 50;
            this.grid.Children.Add(g_tbStatus);
        }

        private void CancelBtn_Click(object sender, RoutedEventArgs e)
        {
            mainWnd.ClearL398Btn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
            g_tbStatus.Text = "You may start signing now.";
        }

        private void OKBtn_Click(object sender, RoutedEventArgs e)
        {
            mainWnd.SaveImageL398Btn.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
            g_tbStatus.Text = mainWnd.textL398Status.Text;
        }
    }
}
